home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / E-G / Encryption Demo.cpt / Encryption Demo / card_3038.txt < prev    next >
Text File  |  1989-02-26  |  5KB  |  196 lines

  1. -- card: 3038 from stack: in
  2. -- bmap block id: 2244
  3. -- flags: 0000
  4. -- background id: 2601
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on openCard
  8.   --fill in initial values for the fields
  9.   put "Type anything you want in this field" into card field "Original Value"
  10.   put "The encrypted text will appear here" into card field "Encrypted"
  11.   put "The decrypted text will appear here" into card field "Decrypted"
  12.   hide card button "Decrypt"
  13. end openCard
  14.  
  15.  
  16.  
  17. -- part 5 (button)
  18. -- low flags: 00
  19. -- high flags: A002
  20. -- rect: left=47 top=127 right=147 bottom=114
  21. -- title width / last selected line: 0
  22. -- icon id / first selected line: 0 / 0
  23. -- text alignment: 1
  24. -- font id: 0
  25. -- text size: 12
  26. -- style flags: 0
  27. -- line height: 16
  28. -- part name: Encrypt
  29. ----- HyperTalk script -----
  30. on mouseUp
  31.   --a field must Encrypt itself, so send message to field
  32.   send "Encrypt" to card field "Original Value"
  33.   --enable decrypt button
  34.   show card button "Decrypt"
  35. end mouseUp
  36.  
  37.  
  38.  
  39. -- part 6 (button)
  40. -- low flags: 80
  41. -- high flags: A002
  42. -- rect: left=47 top=163 right=183 bottom=114
  43. -- title width / last selected line: 0
  44. -- icon id / first selected line: 0 / 0
  45. -- text alignment: 1
  46. -- font id: 0
  47. -- text size: 12
  48. -- style flags: 0
  49. -- line height: 16
  50. -- part name: Decrypt
  51. ----- HyperTalk script -----
  52. on mouseUp
  53.   --send message to field to Decrypt itself
  54.   send "Decrypt" to card field "Encrypted"
  55. end mouseUp
  56.  
  57.  
  58.  
  59. -- part 7 (button)
  60. -- low flags: 00
  61. -- high flags: 2000
  62. -- rect: left=67 top=188 right=225 bottom=100
  63. -- title width / last selected line: 0
  64. -- icon id / first selected line: 26425 / 26425
  65. -- text alignment: 1
  66. -- font id: 0
  67. -- text size: 12
  68. -- style flags: 0
  69. -- line height: 16
  70. -- part name: More
  71. ----- HyperTalk script -----
  72. on mouseUp
  73.   go to next card
  74. end mouseUp
  75.  
  76.  
  77.  
  78. -- part 8 (button)
  79. -- low flags: 00
  80. -- high flags: A002
  81. -- rect: left=47 top=283 right=303 bottom=114
  82. -- title width / last selected line: 0
  83. -- icon id / first selected line: 0 / 0
  84. -- text alignment: 1
  85. -- font id: 0
  86. -- text size: 12
  87. -- style flags: 0
  88. -- line height: 16
  89. -- part name: Help
  90. ----- HyperTalk script -----
  91. on mouseUp
  92.   show card field "Info"
  93. end mouseUp
  94.  
  95.  
  96.  
  97. -- part 10 (field)
  98. -- low flags: 00
  99. -- high flags: 6002
  100. -- rect: left=121 top=63 right=132 bottom=440
  101. -- title width / last selected line: 0
  102. -- icon id / first selected line: 0 / 0
  103. -- text alignment: 0
  104. -- font id: 3
  105. -- text size: 9
  106. -- style flags: 0
  107. -- line height: 12
  108. -- part name: Original Value
  109. ----- HyperTalk script -----
  110. on Encrypt
  111.   --When this field invokes the Crypt("E") function, it receives
  112.   --an encrypted version of its own value.  This script places the
  113.   --result into the field below.
  114.   put crypt("E") into card field "Encrypted"
  115. end Encrypt
  116.  
  117.  
  118. -- part 11 (field)
  119. -- low flags: 01
  120. -- high flags: 2002
  121. -- rect: left=121 top=141 right=210 bottom=440
  122. -- title width / last selected line: 0
  123. -- icon id / first selected line: 0 / 0
  124. -- text alignment: 0
  125. -- font id: 3
  126. -- text size: 9
  127. -- style flags: 0
  128. -- line height: 12
  129. -- part name: Encrypted
  130. ----- HyperTalk script -----
  131. on Decrypt
  132.   --this handler places the decrypted version of the data into the
  133.   --field below.
  134.   put crypt("D") into card field "Decrypted"
  135. end Decrypt
  136.  
  137.  
  138.  
  139. -- part 12 (field)
  140. -- low flags: 01
  141. -- high flags: 2002
  142. -- rect: left=121 top=219 right=288 bottom=440
  143. -- title width / last selected line: 0
  144. -- icon id / first selected line: 0 / 0
  145. -- text alignment: 0
  146. -- font id: 3
  147. -- text size: 9
  148. -- style flags: 0
  149. -- line height: 12
  150. -- part name: Decrypted
  151.  
  152.  
  153. -- part 9 (field)
  154. -- low flags: 81
  155. -- high flags: 0002
  156. -- rect: left=40 top=42 right=319 bottom=473
  157. -- title width / last selected line: 0
  158. -- icon id / first selected line: 0 / 0
  159. -- text alignment: 0
  160. -- font id: 4
  161. -- text size: 9
  162. -- style flags: 0
  163. -- line height: 12
  164. -- part name: Info
  165. ----- HyperTalk script -----
  166. on mouseUp
  167.   hide card field "Info"
  168. end mouseUp
  169.  
  170.  
  171. -- part contents for card part 9
  172. ----- text -----
  173.  
  174.               Simple Data Encryption for HyperCard
  175.                  by Steve Daly (CIS 76174,1564)
  176.  
  177.  
  178.   This  stack  contains  an  XFCN  named  'Crypt',  which  performs  a rudimentary encryption of the contents of a field.  Crypt has a single parameter, which should be a D or an E, (for Decrypt or Encrypt).  The function  should be  invoked  by the  field to be encrypted.   See the scripts  for background fields  one and two  for examples of  how this works.   The  messages  defined  in  this  script are sent by the app-ropriate buttons.
  179.  
  180.   The  global 'CryptPass'  contains a password used by Crypt.  In this stack,  it is set by  Hypercard's  ASK PASSWORD command.   This global should always be set to something before Crypt is invoked.
  181.  
  182.   The  encryption  routine  is not very  fancy,  but simply provides a basic encryption  service.   This may provide some  peace of mind when you have to take your hard disk in for service.
  183.  
  184.               Click anywhere in this field to continue
  185.  
  186. -- part contents for card part 10
  187. ----- text -----
  188. Type anything you want in this field
  189.  
  190. -- part contents for card part 11
  191. ----- text -----
  192. The encrypted text will appear here
  193.  
  194. -- part contents for card part 12
  195. ----- text -----
  196. The decrypted text will appear here